package com.bat.spring.factorybean;

import org.springframework.beans.factory.FactoryBean;
import org.springframework.stereotype.Component;

import java.util.concurrent.locks.ReentrantLock;

@Component
public class MyFactoryBean implements FactoryBean<Orange> {

	@Override
	public Orange getObject(){
		return new Orange();
	}

	@Override
	public Class<Orange> getObjectType(){
		return Orange.class;
	}
}

/**
 * AbstractBeanFactory#getObjectForBeanInstance
 * !(beanInstance instanceof FactoryBean) || BeanFactoryUtils.isFactoryDereference(name)
 * AbstractBeanFactory#getObjectForBeanInstance
 * FactoryBeanRegistrySupport#doGetObjectFromFactoryBean
 *
 *
 *
 * factoryBeanObjectCache ：  缓存getObject()获取的单例
       --- FactoryBeanRegistrySupport#getCachedObjectForFactoryBean
     allBeanNamesByType：  缓存  getObjectType ：FactoryBean
 */
